package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.LitemallRegionMapper;
import org.linlinjava.litemall.db.domain.LitemallRegion;
import org.linlinjava.litemall.db.domain.LitemallRegionExample;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author jie
 * @date 2019/7/19 -16:44
 */
@Service
@CacheConfig(cacheNames = "region_cache")
public class LitemallRegionService {

    @Resource
    private LitemallRegionMapper regionMapper;

    @Cacheable(key = "#root.methodName")
    public List getAllRegions(){
        return regionMapper.getAllRegions();
    }

    public List<LitemallRegion> getAll(){
        LitemallRegionExample example = new LitemallRegionExample();
        byte b = 4;
        example.or().andTypeNotEqualTo(b);
        return regionMapper.selectByExample(example);
    }
}
